import { allListCommunity } from '@/api/house/communitymanagement'
import { allListFloor } from "@/api/house/buildmanagement";
import { allListBuilding } from "@/api/house/roommanagement";
import { allListRoom } from "@/api/house/layoutmanagement";
import { allListAudiovisualRoom } from "@/api/movie/movieroom";
import { allListCategory } from "@/api/food/type";
import { getToken, setToken, removeToken } from '@/utils/auth'
const common = { 
  state: {
	allListCommunity:[], //所有小区
	allListFloor:[], //所有楼宇
	allHomeType:[],//所有房型
	allRoom:[],//所有房屋
	allDish:[],//所有菜品类别
	allAudiovisualRoom:[],//所有影音室
	//住户审核状态
	peopleUserStatus:[
		{ name:'正常', type:0 },
		{ name:'审核中', type:1 },
		{ name:'待审核', type:2 },
		{ name:'不通过', type:3 },
	],
	//住户类型
	peopleUserType:[
		{ name:'业主', type:0 },
		{ name:'家属', type:1 },
		{ name:'租户', type:2 },
		{ name:'其他', type:3 },
	],
	//房屋类型
	houseType:[
		{ name:'空置', type:0 },
		{ name:'居住中', type:1 },
		{ name:'挂租中', type:2 },
		{ name:'申请挂租', type:3 },
		{ name:'挂租审核中', type:4 },
		{ name:'租住中', type:5 },
		{ name:'审核拒绝', type:9 },
	],
	//挂租状态类型 
	rentStatus:[
		{ name:'下架', type:0 },
		{ name:'开放中', type:1 },
		{ name:'待入住', type:2 },
		{ name:'已入住', type:3 },
		{ name:'已退房', type:4 },
		{ name:'已退房', type:5 },
		{ name:'维修中', type:9 },
	],
	//物业费缴费状态
	payStatus:[
		{ name:'未缴费', type:0 },
		{ name:'待教费', type:1 },
		{ name:'已缴费', type:2 },
		{ name:'作废', type:9 },
	],
	//物业缴费方式
	payWay:[
		{ name:'余额', type:0 },
		{ name:'微信', type:1 },
		{ name:'其他方式', type:9 },
	],
	//物业订单服务状态 
	serveStatus:[
		{ name:'未处理', type:0 },
		{ name:'处理中', type:1 },
		{ name:'待付款', type:2 },
		{ name:'已处理', type:3 },
	],
	//物业订单服务类型
	serveType:[
		{ name:'保洁', type:0 },
		{ name:'维修', type:1 },
	],
	//公告类型 0-服务公告 1-交通指引 2-资讯
	noticeType:[
		{ name:'服务公告', type:0 },
		{ name:'交通指引', type:1 },
		{ name:'资讯', type:2 },
	],
	//公告显示状态 	
	noticeStatus:[
		{ name:'不显示', type:0 },
		{ name:'显示', type:1 }
	],
	//包间类型 
	chessType:[ 
		{ name:'包间', type:1 },
		{ name:'大厅', type:2 }
	],
	//包间类型
	prRoomType:[
		{ name:'大包', type:1 },
		{ name:'中包', type:2 },
		{ name:'大包', type:3 },
	],
	//棋牌室状态
	chessStatus:[
		{ name:'开放', type:1 },
		{ name:'关闭', type:0 },
	],
	//菜品状态
	dishStatus:[
		{ name:'开放', type:1 },
		{ name:'关闭', type:0 },
	],
	//温泉室状态
	roomStatus:[
		{ name:'开放', type:1 },
		{ name:'关闭', type:0 },
	],
	//温泉室套餐状态
	cardStatus:[
		{ name:'开放', type:1 },
		{ name:'关闭', type:0 },
	],
	//书画状态
	courseStatus:[
		{ name:'开放', type:1 },
		{ name:'关闭', type:0 },
	],
	//配套服务
	supportServices:[
		{ type:'基础设施', item:['免费WIFI','网络','停车场'],checked:[] },
		{ type:'商务设施', item:['商务中心','会议厅','多功能厅','行政酒廊'],checked:[]  },
		{ type:'服务设施', item:['洗衣服务','接机服务','行李寄存','儿童看护','唤醒服务'],checked:[]  },
		{ type:'餐饮设施', item:['西餐厅','中餐厅','咖啡厅','送餐服务','酒吧'],checked:[]  },
		{ type:'娱乐设施', item:['游泳池','健身房','KTV','儿童乐园','棋牌室','球馆'],checked:[]  },
		{ type:'客房设施', item:['电脑','健身房','KTV','儿童乐园','棋牌室','球馆'],checked:[]  },
		{ type:'客房设施', item:['楼层','国内长途','商台','国际长途','浴缸','冰箱','淋浴','保险箱','热水','迷你吧',],checked:[] }
	],
	//界面配置 页面类型(0-首页banner 1-餐饮banner 2-租房banner 4-物业banner)
	pageType:[
		{ type:'0', name:'首页banner'},
		{ type:'1', name:'餐饮banner'},
		{ type:'2', name:'租房banner'},
		{ type:'4', name:'物业banner'},
	],
  },
  mutations: {
	//设置所有小区
    SET_AllListCommunity: (state, value) => {
      state.allListCommunity = value
    },
	//设置所有楼宇
	SET_AllListFloor: (state, value) => {
	  state.allListFloor = value
	},
	//设置所有房型
	SET_AllListHomeType: (state, value) => {
	  state.allHomeType = value
	},
	//设置所有房屋
	SET_AllListallRoom: (state, value) => {
	  state.allRoom = value
	},
	//设置所有菜品类别
	SET_AllListallDish: (state, value) => {
	  state.allDish = value
	},
	//设置所有影音室 
	SET_AllListallAudiovisualRoom: (state, value) => {
	  state.AudiovisualRoom = value
	},
  }, 
  actions: {  
    // 获取所有小区
    AllCommunityList({ commit, state }) {
      return new Promise((resolve, reject) => {
        allListCommunity().then(res => {
          commit('SET_AllListCommunity', res.data)
          resolve(res.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
	// 获取所有影音室
	AllAudiovisualRoomList({ commit, state }) {
	  return new Promise((resolve, reject) => {
	    allListAudiovisualRoom().then(res => {
	      commit('SET_AllListallAudiovisualRoom', res.data)
	      resolve(res.data)
	    }).catch(error => {
	      reject(error)
	    })
	  })
	},
	// 获取所有菜品类别
	AllDishList({ commit, state }) {
	  return new Promise((resolve, reject) => {
	    allListCategory().then(res => {
	      commit('SET_AllListallDish', res.data)
	      resolve(res.data)
	    }).catch(error => {
	      reject(error)
	    })
	  })
	},
	//  获取所有房型
	AllHomeTypeList({ commit, state }) {
	  return new Promise((resolve, reject) => {
	    allListBuilding().then(res => {
	      commit('SET_AllListHomeType', res.data)
	      resolve(res.data)
	    }).catch(error => {
	      reject(error)
	    })
	  })
	},
	// 获取所有楼宇
	AllFloorList({ commit, state }) {
	  return new Promise((resolve, reject) => {
	    allListFloor().then(res => {
	      commit('SET_AllListFloor', res.data)
	      resolve(res.data)
	    }).catch(error => {
	      reject(error)
	    })
	  })
	},
	// 获取所有房屋
	AllRoomList({ commit, state }) {
	  return new Promise((resolve, reject) => {
	    allListRoom().then(res => {
	      commit('SET_AllListallRoom', res.data)
	      resolve(res.data)
	    }).catch(error => {
	      reject(error)
	    })
	  })
	}
  }
}

export default common
